<template>
	<view>
		<stop isBack>
			<view slot="content">选择设备</view>
		</stop>
		<view >
			<view class="bcf mart3">
				<machine-picker v-model="machine"></machine-picker>
				<view class="pad3">
					<view @tap="startCheck" class="cu-btn line-green w100 round lg">
						开始点检
						<ripple></ripple>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import checkOrder from '../../templete/machine/machine_plan_check_order_item.vue'
	import machinePicker from '../../templete/machine/machine_picker.vue'
	export default {
		components:{checkOrder,machinePicker},
		data() {
			return {
				machine:'',
				where:{
					eq:{
						status:'',
						emergency:'',
						level:'',
					}
				},
				search:"",
				data:[]
			}
		},
		methods: {
			
			startCheck(){
				if(this.isbool(this.machine)){
					this.showLoading()
					this.$api.get('/api/start/machineCheckOrders',{id:this.$com.iriId(this.machine)},res=>{
						this.clearLoading()
						this.log(res)
						if(res.s == 1){
							setTimeout(()=>{this.goto('/pages/machi_check/check_do?id=' + res.d.id)},500)
						}else{
							this.$com.showToast(res.i)
						}
					})
				}else{
					this.$com.showToast('未选择设备')
				}
			}
		},
		mounted() {
			
		},
		onLoad(option) {
			if(this.isbool(option.machine)){
				setTimeout(()=>{
					this.machine = unescape(option.machine)
				})
			}
		},
		watch:{
			machine(val){
				this.log(val)
			}
		}
	}
</script>

<style>

</style>
